
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8">
    <title>账户注册</title>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <!-- 可选的 Bootstrap 主题文件（一般不用引入） -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
    <script src="${pageContext.request.contextPath}/jquery/jquery-3.6.0/jquery-3.6.0.js"></script>

    <style>
        .a{
            height: 130px;
        }
    </style>
    <script>
        function a2() {
            $.ajax({
                type: "post",
                url:"${pageContext.request.contextPath}/a3",
                data:{'userID':$("#userID").val()},
                success:function (data) {
                    if (data.toString()==="OK"){
                        $("#userInfo").css("color","green");

                    }else {
                        $("#userInfo").css("color","red");
                        if (data.toString()==="该账号已被注册，请登录"){
                            $("#userInfo").css("color","red");
                        }/*else alert("请先设置账号");*/

                    }
                    $("#userInfo").html(data);
                }
            })
        }
    </script>
</head>
<body>
<div class="container">
    <div class="a"></div>
    <div class="row clearfix">
        <div class="col-md-4 column">
        </div>
        <div class="col-md-4 column">
            <div class="row clearfix">
                <div class="col-md-4 column">
                </div>
                <div class="col-md-4 column">
                    <img class="mb-4 img-thumbnail" src="${pageContext.request.contextPath}/pic/yiliao.jpg"  width="72" height="72">
                </div>
                <div class="col-md-4 column">
                </div>
            </div>
            <h1 class="text-center text-info">
                账户注册
            </h1>
            <form action="${pageContext.request.contextPath}/addUser" method="post">
                <div class="form-group">
                    <label for="id">学号/学工号：</label><span id="userInfo"></span><input type="text" onblur="a2()" class="form-control" id="userID" name="userID" onkeyup="this.value=this.value.replace(/\D/g,'')" id="id"   maxlength="8"/>
                </div>
                <div class="form-group">
                    <label for="name">姓名：</label><input type="text"  class="form-control" name="uname" id="name" onkeyup="this.value=this.value.replace(/[^\u4e00-\u9fa5]/g,'')" maxlength=4 />
                </div>
                <div class="form-group">
                    <label for="password">密码</label><input type="password" class="form-control" name="password" id="password" />
                    <span style="font-size:20px;color:red;">${register}</span>
                </div>
                <button type="submit" class="btn btn-outline-primary">注册</button>
                <a class="btn btn-outline-primary" href="${pageContext.request.contextPath}/tologin" >去登陆</a>
                <div class="alert alert-light alert-dismissible">

                </div>
                <p align="center" class="mt-5 mb-3 text-muted">&copy;2021-YongXin</p>
            </form>
        </div>
        <div class="col-md-4 column">
        </div>
    </div>
</div>
</body>
</html>
